package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dto.SensitiveDTO;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/*
* TODO 敏感词管理
*  */
@Api(value = "敏感词管理API",tags = "敏感词管理API")
@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController {
    @Autowired
    private AdSensitiveService adSensitiveService;
    /*
    * todo 敏感词查询
    *  分页、关键字搜索
    * */
    @ApiOperation("敏感词查询")
    @PostMapping("/list")
    public ResponseResult queueList(@RequestBody SensitiveDTO sensitiveDTO){
        return this.adSensitiveService.queueList(sensitiveDTO);

    }
    /*
    * TODO 敏感词新增
    *  */
    @ApiOperation("敏感词新增")
    @PostMapping("/save")
    public ResponseResult saveAdSensitive(@RequestBody AdSensitive adSensitive){
        return this.adSensitiveService.saveAdSensitive(adSensitive);
    }
    /*
    * TODO 敏感词修改
    *  */
    @ApiOperation("敏感词修改")
    @PostMapping("/update")
    public ResponseResult updateAdSensitive(@RequestBody AdSensitive adSensitive){
        return this.adSensitiveService.updateAdSensitive(adSensitive);
    }

    /*
    * TODO 敏感词删除
    *  */
    @ApiOperation("敏感词修改")
    @PostMapping("/del/{id}")
    public ResponseResult deleteById(@PathVariable ("id")Integer id){
        return this.adSensitiveService.deleteById(id);
    }

    /*
    * TODO 查询敏感词内容
    *  */
    @ApiOperation("查询敏感词内容list")
    @PostMapping("/sensitives")
    public ResponseResult queueAllSensitives(){
        return this.adSensitiveService.queueAllSensitives();
    }
}
